package com.esxy.manage.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.esxy.entity.TbContentCategory;
import com.esxy.service.TbContentCategoryService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/contentcategory")
public class TbContentCategoryController {

    @Reference(interfaceClass = TbContentCategoryService.class,check = false)
    private TbContentCategoryService tbContentCategoryService;
    @RequestMapping("/getTbContentCategoryAll")
    public String getTbContentCategoryAll(Model model){
        List<TbContentCategory> categoryAll = tbContentCategoryService.getTbContentCategoryAll();
        //封装页面的数据key的名称
        model.addAttribute("types",categoryAll);
        return "types";//这个是页面的名称
    }

    @RequestMapping("/getTbContentAll")
    //    异步加载数据
    @ResponseBody
    public List<TbContentCategory> getTbContentAll(){
        List<TbContentCategory> categoryAll = tbContentCategoryService.getTbContentCategoryAll();
        return categoryAll;
    }
}
